package com.dds.demo.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.dds.demo.entity.PageInfo;
import com.dds.demo.entity.WmsToErp;
import com.dds.demo.mapper.WmsToErpMapper;
import com.dds.demo.service.api.WmsToErpService;
import com.dds.demo.util.BeanUtils;

@Service
public class WmsToErpServiceImpl extends ServiceImpl<WmsToErpMapper, WmsToErp> implements WmsToErpService {
	
	@Autowired
	private WmsToErpMapper mapper;
	
	@Override
	public PageInfo dataGridByList(PageInfo pageInfo) {
		Page<Map<String, Object>> page = new Page<Map<String, Object>>(pageInfo.getNowpage(), pageInfo.getSize());
		List<WmsToErp> list = mapper.dataGridByList(page,pageInfo.getCondition());
		pageInfo.setRows(list);
		pageInfo.setPagesize(page.getSize());
		pageInfo.setNowpage(page.getCurrent());
		WmsToErp con = new WmsToErp();
		BeanUtils.transMap2Bean(pageInfo.getCondition(), con);
		pageInfo.setTotal(mapper.selectCount(new EntityWrapper<WmsToErp>(con)));
		return pageInfo;
	}

	@Override
	public List ByList() {
		// TODO Auto-generated method stub
		return mapper.selectList();
	}

}
